<?php if (count($transactions)):?>
<?php echo $this->Form->create(null, array('url' => array('controller' => 'transaction', 'action' => 'update_status')));?>
	<div class="toolBox">
		<p> <?php if(isset($userName)){echo 'クラスを選択してから希望するボタンを押してください';}else{echo 'The selected courses';} ?></p>
		<ul>
			<li>
				<?php if( !isset($this->params['url']['delete']) || ((isset($this->params['url']['delete']) && ($this->params['url']['delete'] == 0) || $this->params['url']['delete'] ==''))): ?>
				<input type="submit" id="btnDeleteTransaction" class="btnTransaction" value="削除済み" />
				<?php endif;?>
				<?php if(!isset($this->params['url']['delete']) || (isset($this->params['url']['delete']) && ($this->params['url']['delete'] == 1 || $this->params['url']['delete'] ==''))): ?>
				<input type="submit" id="btnUnDeleteTransaction" class="btnTransaction" value="削除を取り消す" />
				<?php endif;?>
				<input type="submit" id="btnSuccessTransaction" class="btnTransaction" value="成功" />
				<input type="submit" id="btnFaultTransaction" class="btnTransaction" value="失敗" />
			</li>
		</ul>
	</div>
	<table id="transactionData">
		<tr>
			<th>チェック</th>
			<th>受付日</th>
			<th>トランザクションID</th>
			<th>ユーザ名</th>
			<th>回収済み参加費用</th>
			<th>支払い方法</th>
			<th>ステータス</th>
		</tr>
		<?php foreach ($transactions as $transaction):?>
		<tr>
			<td><input type="checkbox" class="check" name="data[id][]" id="transaction_<?php echo $transaction['Transaction']['id'];?>" value="<?php echo $transaction['Transaction']['id'];?>" /></td>
			<td><?php echo $this->Time->format('Y.m.d', $transaction['Transaction']['created']);?></td>
			<td><?php echo $transaction['Transaction']['id'];?></td>
			<td><?php if(isset($userName)){
						echo $userName;
					}else{
						echo $this->User->getUsername($transaction);
					}
				?>
			</td>
			<td>¥<?php echo number_format($transaction['Transaction']['amount']);?></td>
			<td><?php echo $transaction['PaymentMethod']['payment_method'];?></td>
			<td><?php echo $transaction['Transaction']['status'] ? '成功' : '失敗';?></td>
		</tr>
		<?php endforeach;?>
		<input type="hidden" name="data[type]" id="hdTransactionType" value="" />
		<input type="hidden" name="data[value]" id="hdTransactionValue" value="" />
	</table>
	<?php echo $this->Form->end();?>
	<div id="pageNationBox">
		<?php echo $this->element('admin_paginator');?>
	</div>
<?php endif;?>